<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script type="text/javascript">
        const getName = new Promise((resolve, reject) => {
            setTimeout(() => {
                resolve("nodejs");
            }, 50);
        });
        const getNumber = Promise.resolve(1);
        const getError = Promise.reject("出错啦");
        getError.catch(console.log);
        promise.all([getName, getName])
            .then(console.log)
            .catch(console.log);
        promise.race([getName, getName])
            .then(console.log)
            .catch(console.log);
        getName
            .then(name => {
                console.log(name);
                return 20;
            })
            .then(number => {
                console.log(number);
            });
    </script>
</body>

</html>